package Try;

import java.io.*;
import java.util.Arrays;

public class Main12 {
    public static void main(String[] args) throws IOException {
        File fileDirector = new File("C:\\Users\\ruanjie\\Desktop\\sample");

        File[] files = fileDirector.listFiles();
        Arrays.sort(files);
        for (int i=0;i<files.length;i++){
            files[i].renameTo(new File("C:\\Users\\ruanjie\\Desktop\\sample_self_sort\\"+i+".png"));
        }



    }


}
